using System;
using System.Data;
using System.Xml;

namespace OR.Lazarus.Library.CPP.Types
{
   public class TypeMapDetail : OR.Lazarus.Library.CPP.Types.Lazarus.TypeMapDetail
   {
		public string ResolveContextType( string pBaseType, string pContext )
		{
			string		vReturn = null;
			TypeDetail	vTypeDetail = null;
			NameDetail	vNameDetail = null;

			vTypeDetail = mTypes[ pBaseType ];

			if ( vTypeDetail == null )
			{
				throw new ApplicationException( String.Format( "TypeMapDetail.ResolveContextType( '{0}', '{1}' ) failed: Cannot resolve the type '{0}'.", pBaseType, pContext ) );
			}
			else
			{
				vNameDetail = vTypeDetail.Names[ pContext ];

				if ( vNameDetail == null )
				{
					throw new ApplicationException( String.Format( "TypeMapDetail.ResolveContextType( '{0}', '{1}' ) failed: Cannot resolve the context '{1}'.", pBaseType, pContext ) );
				}
				else
				{
					vReturn = vNameDetail.Value;
				}
			}

			return ( vReturn );
		}
   }
}
   